-
Notifications
You must be signed in to change notification settings - Fork 132
[Dynamic dashboard] Improve "has orders" logic #11469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
coroutineScope { | ||
launch { fetchPlugins(site) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change to use coroutineScope
with launch
builders is to allow parallel requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clever!
// Fetch a fresh list of order status options | ||
dispatcher.dispatch( | ||
WCOrderActionBuilder | ||
.newFetchOrderStatusOptionsAction(FetchOrderStatusOptionsPayload(site)) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was moved to the SiteObserver
class to ensure it's called both when the app is launched, and when the selected site is changed.
// Update onboarding completed status based on the tasks completion status | ||
if (mobileSupportedTasks.all { it.isComplete }) { | ||
appPrefs.updateOnboardingCompletedStatus(selectedSite.getSelectedSiteId(), true) | ||
} else if (appPrefs.isOnboardingCompleted(selectedSite.getSelectedSiteId())) { | ||
appPrefs.updateOnboardingCompletedStatus(selectedSite.getSelectedSiteId(), false) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving this logic here instead of ShouldShowOnboarding
was to make sure we don't miss updating the status when the onboarding tasks list is empty, this happened to me on one of my sites, and the onboarding card kept being shown then dismissed on each launch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I saw this as well on my site and planned to look into it.
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #11469 +/- ##
========================================
Coverage ? 40.82%
Complexity ? 5219
========================================
Files ? 1072
Lines ? 62936
Branches ? 8615
========================================
Hits ? 25692
Misses ? 34927
Partials ? 2317 ☔ View full report in Codecov by Sentry. |
This is an improvement when the app doesn't any cached orders to tell if the store has orders or not, and would avoid flickering on the main screen during initial load.
This fixes issues where we miss updating the status when we don't have any tasks.
The new logic means we'll fetch on each app launch in addition to site switching.
8e5b448
to
b4acb19
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works like a charm 👏
// Update onboarding completed status based on the tasks completion status | ||
if (mobileSupportedTasks.all { it.isComplete }) { | ||
appPrefs.updateOnboardingCompletedStatus(selectedSite.getSelectedSiteId(), true) | ||
} else if (appPrefs.isOnboardingCompleted(selectedSite.getSelectedSiteId())) { | ||
appPrefs.updateOnboardingCompletedStatus(selectedSite.getSelectedSiteId(), false) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I saw this as well on my site and planned to look into it.
Description
This PR updates the logic of deciding on the availability of the stats cards, for more information check p1715164179010139-slack-C03L1NF1EA3
Testing instructions
OrderEntity
andWCOrderStatusOption
if you want to do it manually)Images/gif
Screen_recording_20240508_104705.webm
Screen_recording_20240508_112721.webm
RELEASE-NOTES.txt
if necessary. Use the "[Internal]" label for non-user-facing changes.